import { post, get } from '@/utils/http'
import request from '@/utils/request'

/**
 * 登录
 * @param {*} data 
 * @returns 
 */
export const login = data => post('/api/Account/Login', data, null, null, false)

/**
 * 刷新token
 * @param {*} params 
 * @returns 
 */
export const refreshToken = params => request({
  url: '/api/Account/RefreshToken',
  method: 'post',
  data: null,
  params: params
})

/**获取用户信息
 * 
 * @returns 
 */
export const getInfo = () => get('/api/User/GetUserInfo')

/**
 * 分页获取用户列表
 * @param {*} data 
 * @returns 
 */
export const getUsersByPage = data => get('/api/user/getUsersByPage', data)

/**
 * 添加用户
 * @param {*} data 
 * @returns 
 */
export const addUser = data => post('/api/user/addUser', data)

/**
 * 编辑用户
 * @param {*} data 
 * @returns 
 */
export const editUser = (data, callback) => post('/api/user/editUser',data, null, callback)

/**
 * 删除用户
 * @param {*} data 
 * @returns 
 */
export const deleteUser = data => post('/api/user/deleteUser', null, data)

/**
 * 分配角色
 * @param {*} data 
 * @returns 
 */
export const distributionRole = data => post('/api/user/distributionRole', data)
